﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
namespace OnlineMediaAnalyzer.Models
{
    public class RSSMap
    {
        public int ID { get; set; }

        [Required(ErrorMessage = "Name is required")]
        [StringLength(32, ErrorMessage = "Name length should be less than 32")]
        public string Name { get; set; }

        [Required(ErrorMessage = "Item mapping is required")]
        [StringLength(32, ErrorMessage = "Item length should be less than 32")]
        public string ItemMapping { get; set; }

        [Required(ErrorMessage = "Title mapping is required")]
        [StringLength(32, ErrorMessage = "Title length should be less than 32")]
        public string TitleMapping { get; set; }

        [Required(ErrorMessage = "Guid mapping is required")]
        [StringLength(32, ErrorMessage = "Guid length should be less than 32")]
        public string GuidMapping { get; set; }

        [Required(ErrorMessage = "Url mapping is required")]
        [StringLength(32, ErrorMessage = "Url length should be less than 32")]
        public string UrlMapping { get; set; }

        [Required(ErrorMessage = "Description mapping is required")]
        [StringLength(32, ErrorMessage = "Description length should be less than 32")]
        public string DescriptionMapping { get; set; }

        [Required(ErrorMessage = "Author mapping is required")]
        [StringLength(32, ErrorMessage = "Author length should be less than 32")]
        public string AuthorMapping { get; set; }

        [Required(ErrorMessage = "Time mapping is required")]
        [StringLength(32, ErrorMessage = "Time length should be less than 32")]
        public string TimeMapping { get; set; }

        [Required(ErrorMessage = "Category mapping is required")]
        [StringLength(32, ErrorMessage = "Category length should be less than 32")]
        public string CategoryMapping { get; set; }

        public virtual ICollection<Feed> Feeds { get; set; }

        [StringLength(32)]
        public string Self
        {
            get
            {
                return string.Format(CultureInfo.CurrentCulture,
                    "api/rssmaps/{0}", this.ID);
            }
            set { }
        }
    }
}